package com.mystudy.springcloud.controller;

import com.mystudy.springcloud.entities.CommonResult;
import com.mystudy.springcloud.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StorageController {
	@Autowired
	private StorageService storageService;

	/**
	 * @功能: 减库存
	 * @作者: 高志红
	 */
	@PostMapping(value = "/storage/decrease")
	CommonResult decrease(@RequestParam("productId") Long productId, @RequestParam("count") Integer count) {
		storageService.decreaseStorage(productId, count);
		return new CommonResult(200, "库存扣减成功！");
	}
}

